<template>
	<div class="home">
		<!-- 搜索框 -->
		<search></search>
		
		<!-- 轮播图 -->
		<swiper :datas="datas"></swiper>
		
		<!-- 分类 -->
		<category :datas="datas"></category>
		
		<!-- 广告 -->
		<ad :datas="datas" v-if="datas.advertesPicture"></ad>
		
		<!-- 推荐 -->
		<recommonds :datas="datas"></recommonds>
		
		<!-- 楼层 -->
		<floors v-if="datas.floor1" :floor="datas.floor1"></floors>
		
		<floors v-if="datas.floor2" :floor="datas.floor2"></floors>
		
		<floors v-if="datas.floor3" :floor="datas.floor3"></floors>
		
		<tab-bar></tab-bar>
	</div>
</template>

<script>
	import search from "./components/search.vue"
	import swiper from "./components/swiper.vue"
	import category from "./components/category.vue"
	import ad from "./components/ad.vue"
	import recommonds from "./components/recommonds.vue"
	import floors from "./components/floors.vue"
	
	import {getIndexInfo} from "api/home.js"
	
	export default {
		components:{
			search,
			swiper,
			category,
			ad,
			recommonds,
			floors
		},
		data(){
			return{
				datas:{}//首页数据
			}
		},
		methods:{
			async API_getIndexInfo(){
				return await getIndexInfo()
			}
		},
		async created(){
			let res = await getIndexInfo()
			console.log(res.data.data)
			
			this.datas = res.data.data
		}
	}
</script>

<style lang="scss" scoped>
	.home{
		padding-bottom: 50px;
	}
</style>
